import { defineStore } from "pinia"
import { 
  getAllRoomList,
  addRoomInfo,
  editRoomInfo,
  deleteRoomInfo,
  getRoomDetail
} from "@/api/room/index"
import type { 
} from "@/api/room/types"

export const roomStore = defineStore('room', {
  state: () => ({
  }),
  actions: {
    async getAllRoomList(params) {
      try {
        const data = await getAllRoomList(params)
        return Promise.resolve(data)
      } catch(error) {
        return Promise.reject(error)
      }
    },
    async addRoomInfo(params) {
      try {
        const data = await addRoomInfo(params)
        return Promise.resolve(data)
      } catch(error) {
        return Promise.reject(error)
      }
    },
    async editRoomInfo(params) {
      try {
        const data = await editRoomInfo(params)
        return Promise.resolve(data)
      } catch(error) {
        return Promise.reject(error)
      }
    },
    async deleteRoomInfo(params) {
      try {
        const data = await deleteRoomInfo(params)
        return Promise.resolve(data)
      } catch(error) {
        return Promise.reject(error)
      }
    },
    async getRoomDetail(params) {
      try {
        const data = await getRoomDetail(params)
        return Promise.resolve(data)
      } catch(error) {
        return Promise.reject(error)
      }
    },
  },
  getters: {
  }
})
